package com.jeesite.modules.common.web;

import com.jeesite.modules.common.service.SysMsgService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @description:
 * @author: ciye
 * @date: 2022/9/29 15:16
 */
@Controller
@RequestMapping(value = "${adminPath}/sysMsg")
public class SysMsgController {
    @Autowired
    private SysMsgService sysMsgService;

    /**
     * 通过bizKey, bizType, receiveUserCode将消息标记为已读
     * @param bizKey
     * @param bizType
     * @param receiveUserCode
     */
    @RequestMapping(value = "makeMsgReadByBiz")
    public void makeMsgReadByBiz(String bizKey, String bizType, String receiveUserCode) {
        sysMsgService.makeMsgReadByBiz(bizKey, bizType, receiveUserCode);
    }

    /**
     * 将某个接收者的所有的未读消息设置为已读
     * receiveUserCode为空，则是所有的未读消息设置为已读
     * @param receiveUserCode
     */
    @RequestMapping(value = "makeAllMsgRead")
    public void makeAllMsgRead(String receiveUserCode){
        sysMsgService.makeAllMsgRead(receiveUserCode);
    }
}
